<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mod_content extends CI_Controller {
    private $per_page =3;
    private $total_rows =3;
    private $uri_page ='';
    private $base_page = '';
    private $uri_segment='';
    function  __construct(){
        parent::__construct(); 
        if($this->session->userdata('ngonngu') && $this->session->userdata('ngonngu')=='_en') {
            $this->rear = '_en';
            $this->lang->load('atta','english');
        }
        else{
            $this->rear = '';
            $this->lang->load('atta','vietnam');
        }  
    }
    function index()
    {
        $theme_setting = $this->common_model->getone('index_setting',array('id'=>1));
        $cat_index = $theme_setting->cat_index;
        $cat_index2 = explode(',',$cat_index);
        if(!empty($cat_index2))
        {
            foreach ($cat_index2 as $cat)
            {
                $dat['cat_index'][$cat]['info'] = $this->common_model->getone('danhmuctt',array('publish'=>1,'id'=>$cat));
                $dat['cat_index'][$cat]['data_post'] = $this->common_model->getdata('tintuc',array('publish'=>1,'iddanhmuc'=>$cat));
            }
        }
        $dat['slideshow'] = $this->common_model->getdata('slideshow',array('publish'=>1),'',array('id','DESC'),$theme_setting->number_slideshows);
        $dat['news_top'] = $this->common_model->getdata('tintuc',array('noibat'=>1),array('id','title','title_seo','title_en'),array('id','DESC'),$theme_setting->number_breackshows);
        $dat['giaovien'] = $this->common_model->getdata('users',array('taikhoan'=>1),'','',8);
        $dat['comment'] = $this->common_model->getdata('comments',array('comment_type'=>2),'',array('comments_id','DESC'),$theme_setting->number_comment_shows);
        $dat['rear'] = $this->rear;
        return $this->load->view('mod_content/view_content.php',$dat,true);
    }
}